package com.example.demo.pattern.factory;

/**
 * @author chenchao
 * @date 2021/11/8
 */
public class FactoryPatternDemo {

    public static void main(String[] args) {
        Product product = ProductFactory.create();
        product.execute();
    }

    public interface Product {

        void execute();

    }


    public static class ProductImpl implements Product {
        @Override
        public void execute() {
            System.out.print("产品1的功能实现");
        }

    }

    public static class ProductFactory {

        public static Product create() {
            return new ProductImpl();
        }

    }

}
